package com.example.vuecms.controller;

import com.example.vuecms.entity.Cart;
import com.example.vuecms.entity.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("shopping")
public class ShoppingCatController {

    @RequestMapping("goodsList/{ids}")
    @CrossOrigin(origins="*",allowCredentials="true")
    public Result goodsList(@PathVariable int[] ids) {
        Cart c1 = new Cart(1, 87, "华为 荣耀6plus 16G双4G版",2195,"https://img14.360buyimg.com/n4/jfs/t7297/154/3413903491/65679/45ae4902/59e42830N9da56c41.jpg");
        Cart c2 = new Cart(2, 88, "Apple iPhone X (A1865) 64GB 银色 移动联通电信4G手机",8888,"https://img12.360buyimg.com/n1/s180x180_jfs/t1/8342/7/3459/146359/5bd6d1e4Ee55f9e9a/ffd34ff5200c3f03.jpg");
        Cart c3 = new Cart(2, 89, "R17 幻色渐变机身屏下指纹手机 6+128G 6.4英寸",4200,"https://img11.360buyimg.com/n1/s160x160_jfs/t25933/152/1888614462/249755/93df731/5bbead6eN6f825236.jpg");
        List<Cart> list = new ArrayList<Cart>();
        list.add(c1);list.add(c2);list.add(c3);
        return new Result(0, list);
    }
}
